//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<logic_manager.h>
///	@path	~/src/engine/xcore/
///	@date	2008/04/04
///	@desc	Manages game logic components such as events and scene and entities.

#pragma once

#include "xeres.h"

#include "scene/SceneManager.h"
#include "scene/EntityManager.h"

#include "engine/xcore/timer_center.h"
#include "engine/xcore/event_center.h"
#include "engine/xcore/task_manager.h"

namespace xeres {

	/*! 
		\class	LogicManager
		\brief	
	*/
	class LogicManager : public SceneManager , public EntityManager
	{
	protected:

		/// \name Constructor & Destructor
		//@{

		/// \ctor
		LogicManager( void );

		/// \dtor
		~LogicManager( void );

		//@}

		/// \name Initialize & Finalize
		//@{

		/// \brief Initialize logic manager.
		void Initialize( ResourceLoader * loader , RefWeak<IData> scene_config );

		/// \brief Finalize logic manager.
		void Finalize( void );

		//@}

	public:

		/// \name Scene Manipulation
		//@{

		/// \brief	Pre-load scene, for async loading.
		TaskReturn PreLoadScene( const WString& name );

		//@}

		/// \name Interface Manipulation
		//@{

		/// \brief Tick update for game logics. Notice it won't call SceneManager::Tick & EntityManager::Tick, engine should call them later.
		void Tick( const Frame& frame );

		//@}

	private:

		//@ data
	};

} // namespace xeres
